package com.weng.cloud.starter.batch.listener;

import com.weng.cloud.commons.base.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;

/**
 * @Author: weng
 * @Date: 2022/3/20
 * @Description: com.weng.cloud.starter.batch.listener
 */
@Slf4j
public class LogJobExecutionListener implements JobExecutionListener {
    @Override
    public void beforeJob(JobExecution jobExecution) {
        log.info("批处理之前的日志 => "+ JsonUtil.toText(jobExecution));
    }

    @Override
    public void afterJob(JobExecution jobExecution) {
        log.info("批处理之后的日志 => "+ JsonUtil.toText(jobExecution));
    }
}
